package com.qys.livesMall.system.controller.sys;

import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.view.QysPage;
import com.qys.livesMall.system.modal.dto.ThinkTanksInfoQuery;
import com.qys.livesMall.system.modal.entity.SysThinkTanksInfo;
import com.qys.livesMall.system.service.SysThinkTanksInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 系统智库问题
 *
 * @author
 * @since 2023-10-31
 */
@RestController
@RequestMapping("/sys/thinkTanks/info")
public class SysThinkTanksInfoController {

    @Autowired
    private SysThinkTanksInfoService thinkTanksInfoService;

    /**
     * 查询
     * @param search
     * @return
     */
    @PostMapping("/search")
    public R<QysPage<SysThinkTanksInfo>> search(@RequestBody ThinkTanksInfoQuery search){
        return R.ok(thinkTanksInfoService.search(search));
    }

    /**
     * 新增
     * @param info
     * @return
     */
    @PostMapping("/add")
    public R add(@RequestBody SysThinkTanksInfo info){
        thinkTanksInfoService.add(info);
        return R.ok();
    }

    /**
     * 编辑
     * @param info
     * @return
     */
    @PostMapping("/edit")
    public R edit(@RequestBody SysThinkTanksInfo info){
        thinkTanksInfoService.edit(info);
        return R.ok();
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @PostMapping("/del/{id}")
    public R del(@PathVariable("id") Integer id){
        thinkTanksInfoService.del(id);
        return R.ok();
    }
}
